package com.zw.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.zw.annotation.Excel;
import com.zw.annotation.Excels;
import com.zw.core.domain.entity.SysUser;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 项目信息
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "project", description = "项目信息")
@TableName("pt_project")
public class Project implements Serializable {

    @Schema(description = "项目ID")
    private Long id;

    @Excel(name = "项目名")
    @NotBlank(message = "项目名不能为空")
    @Schema(description = "项目名")
    private String name;

    @Excel(name = "项目描述")
    @Schema(description = "项目描述")
    private String description;

    @Excel(name = "项目封面")
    @Schema(description = "项目封面")
    private String coverImage;

    @Schema(description = "目录ID")
    private Long directoryId;

    @Schema(description = "用户ID")
    private Long userId;

    @Excels(
            {@Excel(name = "用户名", targetAttr = "userName", type = Excel.Type.EXPORT),
            @Excel(name = "用户昵称", targetAttr = "nickName", type = Excel.Type.EXPORT)}
    )
    @TableField(exist = false)
    private SysUser user;

    @Schema(description = "模板ID")
    @NotNull(message = "没有选择模板")
    private Long templateId;

    @Excel(name = "预算项")
    @Schema(description = "预算项")
    private Integer budgetItem;

    @Excel(name = "总预算")
    @Schema(description = "总预算")
    private BigDecimal budgetSum;

    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private LocalDateTime createTime;

    @Excel(name = "更新时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "删除标志")
    @TableLogic(value = "0", delval = "1")
    private Integer delFlag;

    @Schema(description = "备用金比率")
    private Double spareMoneyRatio;
}
